{"ast":null,"code":"var __rest = this && this.__rest || function (s, e) {\n  var t = {};\n  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n  if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n    if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n  }\n  return t;\n};\nimport { ItemGroup } from 'rc-menu';\nimport * as React from 'react';\nimport MenuDivider from '../MenuDivider';\nimport MenuItem from '../MenuItem';\nimport SubMenu from '../SubMenu';\nfunction convertItemsToNodes(list) {\n  return (list || []).map((opt, index) => {\n    if (opt && typeof opt === 'object') {\n      const _a = opt,\n        {\n          label,\n          children,\n          key,\n          type\n        } = _a,\n        restProps = __rest(_a, [\"label\", \"children\", \"key\", \"type\"]);\n      const mergedKey = key !== null && key !== void 0 ? key : `tmp-${index}`;\n      // MenuItemGroup & SubMenuItem\n      if (children || type === 'group') {\n        if (type === 'group') {\n          // Group\n          return /*#__PURE__*/React.createElement(ItemGroup, Object.assign({\n            key: mergedKey\n          }, restProps, {\n            title: label\n          }), convertItemsToNodes(children));\n        }\n        // Sub Menu\n        return /*#__PURE__*/React.createElement(SubMenu, Object.assign({\n          key: mergedKey\n        }, restProps, {\n          title: label\n        }), convertItemsToNodes(children));\n      }\n      // MenuItem & Divider\n      if (type === 'divider') {\n        return /*#__PURE__*/React.createElement(MenuDivider, Object.assign({\n          key: mergedKey\n        }, restProps));\n      }\n      return /*#__PURE__*/React.createElement(MenuItem, Object.assign({\n        key: mergedKey\n      }, restProps), label);\n    }\n    return null;\n  }).filter(opt => opt);\n}\n// FIXME: Move logic here in v5\n/**\n * We simply convert `items` to ReactNode for reuse origin component logic. But we need move all the\n * logic from component into this hooks when in v5\n */\nexport default function useItems(items) {\n  return React.useMemo(() => {\n    if (!items) {\n      return items;\n    }\n    return convertItemsToNodes(items);\n  }, [items]);\n}","map":{"version":3,"names":["__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","ItemGroup","React","MenuDivider","MenuItem","SubMenu","convertItemsToNodes","list","map","opt","index","_a","label","children","key","type","restProps","mergedKey","createElement","assign","title","filter","useItems","items","useMemo"],"sources":["/data/messenger.client/node_modules/antd/es/menu/hooks/useItems.js"],"sourcesContent":["var __rest = this && this.__rest || function (s, e) {\n  var t = {};\n  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n  if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n    if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n  }\n  return t;\n};\nimport { ItemGroup } from 'rc-menu';\nimport * as React from 'react';\nimport MenuDivider from '../MenuDivider';\nimport MenuItem from '../MenuItem';\nimport SubMenu from '../SubMenu';\nfunction convertItemsToNodes(list) {\n  return (list || []).map((opt, index) => {\n    if (opt && typeof opt === 'object') {\n      const _a = opt,\n        {\n          label,\n          children,\n          key,\n          type\n        } = _a,\n        restProps = __rest(_a, [\"label\", \"children\", \"key\", \"type\"]);\n      const mergedKey = key !== null && key !== void 0 ? key : `tmp-${index}`;\n      // MenuItemGroup & SubMenuItem\n      if (children || type === 'group') {\n        if (type === 'group') {\n          // Group\n          return /*#__PURE__*/React.createElement(ItemGroup, Object.assign({\n            key: mergedKey\n          }, restProps, {\n            title: label\n          }), convertItemsToNodes(children));\n        }\n        // Sub Menu\n        return /*#__PURE__*/React.createElement(SubMenu, Object.assign({\n          key: mergedKey\n        }, restProps, {\n          title: label\n        }), convertItemsToNodes(children));\n      }\n      // MenuItem & Divider\n      if (type === 'divider') {\n        return /*#__PURE__*/React.createElement(MenuDivider, Object.assign({\n          key: mergedKey\n        }, restProps));\n      }\n      return /*#__PURE__*/React.createElement(MenuItem, Object.assign({\n        key: mergedKey\n      }, restProps), label);\n    }\n    return null;\n  }).filter(opt => opt);\n}\n// FIXME: Move logic here in v5\n/**\n * We simply convert `items` to ReactNode for reuse origin component logic. But we need move all the\n * logic from component into this hooks when in v5\n */\nexport default function useItems(items) {\n  return React.useMemo(() => {\n    if (!items) {\n      return items;\n    }\n    return convertItemsToNodes(items);\n  }, [items]);\n}"],"mappings":"AAAA,IAAIA,MAAM,GAAG,IAAI,IAAI,IAAI,CAACA,MAAM,IAAI,UAAUC,CAAC,EAAEC,CAAC,EAAE;EAClD,IAAIC,CAAC,GAAG,CAAC,CAAC;EACV,KAAK,IAAIC,CAAC,IAAIH,CAAC,EAAE,IAAII,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACP,CAAC,EAAEG,CAAC,CAAC,IAAIF,CAAC,CAACO,OAAO,CAACL,CAAC,CAAC,GAAG,CAAC,EAAED,CAAC,CAACC,CAAC,CAAC,GAAGH,CAAC,CAACG,CAAC,CAAC;EAChG,IAAIH,CAAC,IAAI,IAAI,IAAI,OAAOI,MAAM,CAACK,qBAAqB,KAAK,UAAU,EAAE,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEP,CAAC,GAAGC,MAAM,CAACK,qBAAqB,CAACT,CAAC,CAAC,EAAEU,CAAC,GAAGP,CAAC,CAACQ,MAAM,EAAED,CAAC,EAAE,EAAE;IAC3I,IAAIT,CAAC,CAACO,OAAO,CAACL,CAAC,CAACO,CAAC,CAAC,CAAC,GAAG,CAAC,IAAIN,MAAM,CAACC,SAAS,CAACO,oBAAoB,CAACL,IAAI,CAACP,CAAC,EAAEG,CAAC,CAACO,CAAC,CAAC,CAAC,EAAER,CAAC,CAACC,CAAC,CAACO,CAAC,CAAC,CAAC,GAAGV,CAAC,CAACG,CAAC,CAACO,CAAC,CAAC,CAAC;EACnG;EACA,OAAOR,CAAC;AACV,CAAC;AACD,SAASW,SAAS,QAAQ,SAAS;AACnC,OAAO,KA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